//
//  XZUISearchBar.m
//  XZIBeeBo
//
//  Created by Sean on 16/4/5.
//  Copyright © 2016年 XZSean. All rights reserved.
//

#import "XZUISearchBar.h"

@implementation XZUISearchBar

/**
 *  自定义搜索框  继承一个UITextField
 */
- (instancetype)initWithFrame:(CGRect)frame{

    if (self = [super initWithFrame:frame]) {
        //apple建议自定义控件在这里进行初始化
        self.background = [UIImage imageNamed:@"searchbar_textfield_background"];
        self.font = [UIFont systemFontOfSize:15];
        self.placeholder = @"请输入关键字";
        //设置搜索放大镜
        UIImageView *searchbarImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"searchbar_textfield_search_icon"]];
        searchbarImageView.width = 30;
        searchbarImageView.height = 30;
        searchbarImageView.contentMode = UIViewContentModeCenter;
        self.leftView = searchbarImageView;
        self.leftViewMode = UITextFieldViewModeAlways;
    }
    return self;
}
+ (instancetype)searchBar{
    return [[self alloc] init];
}


@end
